package aooO.crm.Service.impl;

import aooO.crm.Service.CustomerService;
import aooO.crm.mapper.CustomerMapper;
import aooO.crm.mapper.CustomerRemarkMapper;
import aooO.crm.pojo.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    CustomerMapper customerMapper;
    @Autowired
    CustomerRemarkMapper customerRemarkMapper;

    @Override
    public List<Customer> selectCustomerByConditionForPage(Map<String, Object> map) {
        return customerMapper.selectCustomerByConditionForPage(map);
    }

    @Override
    public int selectTotalPage(Map<String, Object> map) {
        return customerMapper.selectTotalPage(map);
    }

    @Override
    public int insertCustomer(Customer record) {
        return customerMapper.insertCustomer(record);
    }

    @Override
    public List<String> queryCustomerNameByFuzzyName(String customerName) {
        return customerMapper.queryCustomerNameByFuzzyName(customerName);
    }

    @Override
    public String selectCustomerByName(String name) {
        return customerMapper.selectCustomerByName(name);
    }

    @Override
    public int updateCustomer(Customer customer) {
        return customerMapper.updateCustomer(customer);
    }

    @Override
    public Customer selectCustomerById(String id) {
        return customerMapper.selectCustomerById(id);
    }

    @Override
    public Customer selectCustomerDetailById(String id) {
        return customerMapper.selectCustomerDetailById(id);
    }

    @Override
    public int deleteCustomerByIds(String[] ids) {
        customerRemarkMapper.deleteCustomerRemarkByCustomerIds(ids);
        return customerMapper.deleteCustomerByIds(ids);
    }
}
